package com.jcl.recruit.console.api.report;

import com.jcl.core.resp.ApiResponse;
import com.jcl.recruit.console.report.service.ConsoleReportService;
import com.jcl.recruit.elasticsearch.resume.vo.ElasticReportCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @ClassName ConsoleReportController
 * @Author yyliu
 * @Date 2018/12/25 16:07
 * @Version 1.0
 **/
@RestController
@RequestMapping("/console/report")
public class ConsoleReportController {

    @Autowired
    private ConsoleReportService consoleReportService;

    @PostMapping("/elastic/pie")
    public ApiResponse pieChar(@RequestBody ElasticReportCondition condition) {
        List<Map<String, Object>> dataList = consoleReportService.pieChar(condition);
        return ApiResponse.success(dataList);
    }

    @PostMapping("/elastic/bar")
    public ApiResponse barGraph(@RequestBody ElasticReportCondition condition) {
        Map<String, Object> dataMap = consoleReportService.barGraph(condition);
        return ApiResponse.success(dataMap);
    }
}
